{% extends 'user/base.html' %}

{% block page_posts %}layui-this{% endblock %}

{% block content %}
  <!--
      <div class="fly-msg" style="margin-top: 15px;">
        您的邮箱尚未验证，这比较影响您的帐号安全，<a href="activate.html">立即去激活？</a>
      </div>
      -->
  <div class="layui-tab layui-tab-brief" lay-filter="user" id="LAY_uc">
    <ul class="layui-tab-title" id="LAY_mine">
        <li data-type="posts" lay-id="index" class="layui-this">我发的帖（<span>{{ posts.count }}</span>）</li>
      <li data-type="collection" data-url="/collection/find/" lay-id="collection">我收藏的帖（<span>{{ favs.count }}</span>）</li>
    </ul>
    <div class="layui-tab-content" style="padding: 20px 0;" id="LAY_ucm" >
      <div class="layui-tab-item layui-show">
          <ul class="mine-view jie-row">
            {% for post in posts %}
            <li>
                {% if post.is_closed %}
                <span class="jie-status jie-status-ok">已结</span>
                {% else %}
                <span class="jie-status">未结</span>
                {% endif %}
                <a class="jie-title" href="{% url 'post_detail' post.pk %}" target="_blank">{{ post.title }}</a>
                <i class="layui-hide-xs">{{ post.create_at|date:"Y-m-d H:i" }}</i>
                {% if not post.is_closed %}
                <a class="mine-edit layui-hide-xs" href="{% url 'edit_post' post.pk %}" target="_blank">编辑</a>
                {% endif %}
                <em class="layui-hide-xs">{{ post.view_count|default:0 }}阅/{{ comment_count|default:0 }}答</em>
            </li>
            {% endfor %}
          </ul>
      </div>
      <div class="layui-tab-item">
        <ul class="mine-view jie-row">
            {% for post in favs %}
            <li>
                <a class="jie-title" href="{% url 'post_detail' post.pk %}" target="_blank">{{ post.title }}</a>
            </li>
            {% endfor %}
        </ul>
      </div>
    </div>
  </div>
{% endblock %}
